/*
 * @version: v 1.0.0
 * @Github: https://github.com/GitHubGanKai
 * @Author: GitHubGanKai
 * @Date: 2021-01-02 13:21:37
 * @LastEditors: gankai
 * @LastEditTime: 2021-01-02 13:26:38
 * @FilePath: /refactor-with-vue3/src/icons/index.js
 */
import SvgIcon from '@/components/SvgIcon/index.vue'
import 'vite-plugin-svg-icons/register'

// const requireAll = requireContext => requireContext.keys().map(requireContext)
// const requireAll = requireContext => Object.values(requireContext).map((v) => v.default)
const requireAll = requireContext => Object.keys(requireContext).map((key) => requireContext[key])

export default {
    install(app) {
        app.component('svg-icon', SvgIcon);
        const req =
            import.meta.globEager("./svgs/*.svg");
        const svgs = Object.values(req).map((v) => v.default)
        let test = requireAll(req)
            // console.log('svgs:', req, svgs, test)
    }
}